﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chizx.Common
{
    /// <summary>
    /// DataRow封装工具类
    /// @author Chitry
    /// @email  chitry@126.com
    /// @website http://www.chitry.com
    /// </summary>
    public class DataRowHelper
    {
        public static DataRow getDataRow( params string[] dats)
        {
            DataTable dt = new DataTable();
            for (int i = 0; i < dats.Length; i += 2)
            {
                dt.Columns.Add(dats[i]);
            }
            DataRow dr = dt.NewRow();
            for (int i = 1; i < dats.Length; i += 2)
            {
                dr[dats[i - 1]] = dats[i];
            }
            return dr;
        }
    }
}
